package cn.sdhuijin.healthexam.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import cn.sdhuijin.healthexam.ExitApplication;
import cn.sdhuijin.healthexam.R;
import cn.sdhuijin.healthexam.control.AbstractControlActivity;
import cn.sdhuijin.healthexam.util.Constants;

public class BodyJudgeFirstActivity extends AbstractControlActivity implements
		OnClickListener {

	private String createDate;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_body_judge_first);
		ExitApplication.getInstance().addActivity(this);

		Intent intent = getIntent();
		Bundle bundle = intent.getBundleExtra("bundle");
		if (bundle != null) {
			createDate = bundle.getString("createDate");
		}
		setCurrentEditUserName(createDate);

		addRadioGroupView(R.id.rad_1, "question01");
		addRadioGroupView(R.id.rad_2, "question02");
		addRadioGroupView(R.id.rad_3, "question03");
		addRadioGroupView(R.id.rad_4, "question04");
		addRadioGroupView(R.id.rad_5, "question05");

		setButtonListener(this, R.id.btn_next, R.id.btn_back);

		controlManager.setPropertiesPath(Constants.PROPERTIES_PATH + createDate
				+ ".txt");
		controlManager.toControl();
	}

	@Override
	public void onClick(View v) {
		Intent intent = new Intent();
		Bundle bundle = new Bundle();
		// 获取点击按钮ID
		int id = (Integer) v.getId();
		switch (id) {
		case R.id.btn_next:
			controlManager.toProperties();
			intent.setClass(this, BodyJudgeSecondActivity.class);
			bundle.putString("createDate", createDate);
			intent.putExtra("bundle", bundle);
			startActivity(intent);
			this.finish();
			break;
		case R.id.btn_back:
			this.finish();
			break;
		default:
			break;
		}
	}

}
